/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.baladaboa.ws.core;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Leone
 */
@Entity
@Table(name = "forma_contato", catalog = "dbbaladaboa", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FormaContato.findAll", query = "SELECT f FROM FormaContato f"),
    @NamedQuery(name = "FormaContato.findByIdformaContato", query = "SELECT f FROM FormaContato f WHERE f.idformaContato = :idformaContato"),
    @NamedQuery(name = "FormaContato.findByDescricao", query = "SELECT f FROM FormaContato f WHERE f.descricao = :descricao")})
public class FormaContato implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idforma_contato", nullable = false)
    private Integer idformaContato;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "descricao", nullable = false, length = 25)
    private String descricao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "formaContatoIdformaContato")
    private List<Contato> contatoList;

    public FormaContato() {
    }

    public FormaContato(Integer idformaContato) {
        this.idformaContato = idformaContato;
    }

    public FormaContato(Integer idformaContato, String descricao) {
        this.idformaContato = idformaContato;
        this.descricao = descricao;
    }

    public Integer getIdformaContato() {
        return idformaContato;
    }

    public void setIdformaContato(Integer idformaContato) {
        this.idformaContato = idformaContato;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @XmlTransient
    public List<Contato> getContatoList() {
        return contatoList;
    }

    public void setContatoList(List<Contato> contatoList) {
        this.contatoList = contatoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idformaContato != null ? idformaContato.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FormaContato)) {
            return false;
        }
        FormaContato other = (FormaContato) object;
        if ((this.idformaContato == null && other.idformaContato != null) || (this.idformaContato != null && !this.idformaContato.equals(other.idformaContato))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.baladaboa.ws.core.FormaContato[ idformaContato=" + idformaContato + " ]";
    }
    
}
